package com.shop.game.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.shop.game.entry.Exchange;
import com.shop.game.service.ExchangeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigInteger;
import java.util.List;

@RestController
@RequestMapping("game")
public class IndexController {

    @Autowired
    private ExchangeService exchangeService;
    @GetMapping("index")
    public String index() {
        exchangeService.addExchange();
        return "game/index";
    }

    @GetMapping("getUserList/{userId}")
    public IPage<Exchange> getUserList(@PathVariable("userId") BigInteger userId,@RequestParam(defaultValue = "1") int pageNum,@RequestParam(defaultValue = "10") int pageSize) {
        IPage<Exchange> exchanges =  exchangeService.selectUserAll(pageNum,pageSize,userId);
        return exchanges;
    }
}
